<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>BalanceSheet</title>
    <link rel="stylesheet" type="text/css" href="style/table-sheet.css">
    <link rel="stylesheet" type="text/css" href="style/bootstrap.css">
    <script src="js/jquery-3.1.1.min.js"></script>
    <script src="js/bootstrap.js"></script>
    <script>



        function showBs(period) {
            // 1 5 9 13
            var BalanceSheet = {period :period};//本年
           /* var BalanceSheet2 = {period :period==1?0:period-1}; //上个年度*/
            var BalanceSheet2 = {period :period-4};
            var myYear = parseInt(period/4);
           /* var myYear = parseInt(period);*/
            $.ajax({
                type: "post",
                dataType: "json",
                data:JSON.stringify(BalanceSheet2),
                url: "/Balancesheet/listbyteamperiod",
                contentType: "application/json;charset=utf-8;",
                success: function (data) {
                    data = data['data'];
                    console.log(data);
                    if(data != null)
                    { $("#bs-title").html("第"+myYear+"年资产负债表")}

                    $("#period").text(data.period);
                    $("#money_now").text(data.moneyNow);
                    $("#money_get").text(data.moneyGet);
                    $("#money_making").text(data.moneyMaking);
                    $("#money_sale").text(data.moneySale);
                    $("#money_buy").text(data.moneyBuy);
                    $("#money_flow").text(data.moneyFlow);
                    $("#long_term_loan").text(data.longTermLoan);
                    $("#short_term_loan").text(data.shortTermLoan);
                    $("#long_term_loan_year").text(data.longTermLoanYear==null?0:data.longTermLoanYear);
                    $("#money_loan").text(data.moneyLoan);
                    $("#money_j").text(data.moneyJ);
                    $("#money_incomel").text(data.moneyIncomel);
                    $("#money_p").text(data.moneyP);
                    $("#money_m").text(data.moneyM);
                    $("#money_static").text(data.moneyStatic);
                    $("#money_g").text(data.moneyG);
                    $("#money_stay").text(data.moneyStay);
                    $("#money_year").text(data.moneyYear);
                    $("#money_user").text(data.moneyUser);
                    $("#money_all").text(data.moneyAll);
                    $("#money_alls").text(data.moneyAlls);
                    $("#money_order_get").text(data.moneyOrderGet);
                    $("#money_tax").text(data.moneyTax<0?0:data.moneyTax);

                    console.log('***********资产负债表查询数据');
                    // $('#year').text(Math.floor(data.period / 4))
                    // $('#money_flow').text(data.money_flow)
                }
            });
            $.ajax({
                type: "post",
                dataType: "json",
                data:JSON.stringify(BalanceSheet),
                url: "/Balancesheet/listbyteamperiod",
                contentType: "application/json;charset=utf-8;",
                success: function (data) {
                    data = data['data'];
                    console.log(data);
                    if(data != null)
                    $("#money_now1").text(data.moneyNow);
                    $("#money_get1").text(data.moneyGet);
                    $("#money_making1").text(data.moneyMaking);
                    $("#money_sale1").text(data.moneySale);
                    $("#money_buy1").text(data.moneyBuy);
                    $("#money_flow1").text(data.moneyFlow);
                    $("#long_term_loan1").text(data.longTermLoan);
                    $("#short_term_loan1").text(data.shortTermLoan);
                    $("#long_term_loan_year1").text(data.longTermLoanYear==null?0:data.longTermLoanYear);
                    $("#money_loan1").text(data.moneyLoan);
                    $("#money_j1").text(data.moneyJ);
                    $("#money_incomel1").text(data.moneyIncomel);
                    $("#money_p1").text(data.moneyP);
                    $("#money_m1").text(data.moneyM);
                    $("#money_static1").text(data.moneyStatic);
                    $("#money_g1").text(data.moneyG);
                    $("#money_stay1").text(data.moneyStay);
                    $("#money_year1").text(data.moneyYear);
                    $("#money_user1").text(data.moneyUser);
                    $("#money_all1").text(data.moneyAll);
                    $("#money_alls1").text(data.moneyAlls);
                    $("#money_order_get1").text(data.moneyOrderGet);
                    $("#money_tax1").text(data.moneyTax<0?0:data.moneyTax);

                    console.log('***********资产负债表查询数据');
                    // $('#year').text(Math.floor(data.period / 4))
                    // $('#money_flow').text(data.money_flow)
                }
            });
        }

    </script>
</head>
<body>

<p>  <button type="button" class="btn btn-default btn-sm" onclick="showBs(1)">初始</button>
    <button type="button" class="btn btn-default btn-sm" onclick="showBs(5)">1年</button>
    <button type="button" class="btn btn-default btn-sm" onclick="showBs(9)">2年</button>
    <button type="button" class="btn btn-default btn-sm" onclick="showBs(13)">3年</button>
    <button type="button" class="btn btn-default btn-sm" onclick="showBs(17)">4年</button>
    <button type="button" class="btn btn-default btn-sm" onclick="showBs(21)">5年</button>
    <button type="button" class="btn btn-default btn-sm" onclick="showBs(25)">6年</button>
</p>
<table id="balance">
    <tr>
        <td colspan="6" style="text-align: center;"><p id = "bs-title">资产负债表</p></td>
    </tr>
    <tr class="light">
        <th style="text-align: center">资产</th>
        <th style="text-align: center">期初数</th>
        <th style="text-align: center">期末数</th>
        <th style="text-align: center">负债所有者权益</th>
        <th style="text-align: center">期初数</th>
        <th style="text-align: center">期末数</th>
    </tr>
    <tr >
        <td>流动资产：</td>
        <td><span id=""></span></td>
        <td></td>
        <td>负债：</td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td>现金</td>
        <td style="text-align: center"><span id="money_now"></span></td>
        <td style="text-align: center"><span id="money_now1"></span></td>
        <td>长期负债</td>
        <td style="text-align: center"><span id="long_term_loan"></span></td>
        <td style="text-align: center"><span id="long_term_loan1"></span></td>
    </tr>
    <tr>
        <td>应收款</td>
        <td style="text-align: center"><span id="money_get"></span></td>
        <td style="text-align: center"><span id="money_get1"></span></td>
        <td>短期负债</td>
        <td style="text-align: center"><span id="short_term_loan"></span></td>
        <td style="text-align: center"><span id="short_term_loan1"></span></td>
    </tr>
    <tr>
        <td>在制品</td>
        <td style="text-align: center"><span id="money_making"></span></td>
        <td style="text-align: center"><span id="money_making1"></span></td>
        <td>应付账款</td>
        <td style="text-align: center"><span id="money_order_get"></span></td>
        <td style="text-align: center"><span id="money_order_get1"></span></td>
    </tr>
    <tr>
        <td>成品</td>
        <td style="text-align: center"><span id="money_sale"></span></td>
        <td style="text-align: center"><span id="money_sale1"></span></td>
        <td>应交税金</td>
        <td  style="text-align: center"><span id="money_tax"></span></td>
        <td style="text-align: center"><span id="money_tax1"></span></td>
    </tr>
    <tr>
        <td>原料</td>
        <td style="text-align: center"><span id="money_buy"></span></td>
        <td style="text-align: center"><span id="money_buy1"></span></td>
        <td>一年内到期长期负债</td>
        <td style="text-align: center"><span id="long_term_loan_year"></span></td>
        <td style="text-align: center"><span id="long_term_loan_year1"></span></td>
    </tr>
    <tr>
        <td>流动资产合计:</td>
        <td style="text-align: center"><span id="money_flow"></span></td>
        <td style="text-align: center"><span id="money_flow1"></span></td>
        <td>负债合计:</td>
        <td style="text-align: center"><span id="money_loan"></span></td>
        <td style="text-align: center"><span id="money_loan1"></span></td>
    </tr>
    <tr class="light">
        <td>固定资产：</td>
        <td style="text-align: center"></td>
        <td style="text-align: center"></td>
        <td>所有者权益：</td>
        <td style="text-align: center"></td>
        <td style="text-align: center"></td>
    </tr>
    <tr>
        <td>土地与建筑</td>
        <td style="text-align: center"><span id="money_j"></span></td>
        <td style="text-align: center"><span id="money_j1"></span></td>
        <td>股东资本</td>
        <td style="text-align: center"><span id="money_g"></span></td>
        <td style="text-align: center"><span id="money_g1"></span></td>
    </tr>
    <tr>
        <td>机器与设备</td>
        <td style="text-align: center"><span id="money_p"></span></td>
        <td style="text-align: center"><span id="money_p1"></span></td>
        <td>利润存留</td>
        <td style="text-align: center"><span id="money_stay"></span></td>
        <td style="text-align: center"><span id="money_stay1"></span></td>
    </tr>
    <tr>
        <td>在建工程</td>
        <td style="text-align: center"><span id="money_m"></span></td>
        <td style="text-align: center"><span id="money_m1"></span></td>
        <td>年度净利</td>
        <td style="text-align: center"><span id="money_year"></span></td>
        <td style="text-align: center"><span id="money_year1"></span></td>
    </tr>
    <tr>
        <td>固定资产合计</td>
        <td style="text-align: center"><span id="money_static"></span></td>
        <td style="text-align: center"><span id="money_static1"></span></td>
        <td>所有者权益合计</td>
        <td style="text-align: center"><span id="money_user"></span></td>
        <td style="text-align: center"><span id="money_user1"></span></td>
    </tr>
    <tr>
        <td>资产总计:</td>
        <td style="text-align: center"><span id="money_all"></span></td>
        <td style="text-align: center"><span id="money_all1"></span></td>
        <td>负债和所有者权益总计:</td>
        <td style="text-align: center"><span id="money_alls"></span></td>
        <td style="text-align: center"><span id="money_alls1"></span></td>
    </tr>
</table>

</body>
</html>